package com.sunsy.authserver.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sunsy.authserver.beans.po.UniformUser;
import com.sunsy.authserver.beans.po.UserToken;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Map;

/**
 * (UserToken)表数据库访问层
 *
 * @author makejava
 * @since 2021-07-20 14:40:45
 */
@Mapper
public interface UserTokenDao extends BaseMapper<UserToken> {

    @Select("select * from user_token where user_id = #{user_id}")
    UserToken getByUser(Long user_id);

    @Select("select u.id,u.type,u.username from uniform_user u ,user_token ut where u.id = ut.user_id and ut.user_token = #{userToken}")
    Map<String, Object> getUserByUserToken(String userToken);

}